package com.shop.utils;

import org.springframework.stereotype.Component;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

@Component
public class CodeUtils {
    public static String getCode(){
        DateTimeFormatter dateTimeFormatter=DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS");
        String localDate= LocalDateTime.now().format(dateTimeFormatter);
        String randomNumber= String.valueOf(100+(int)(Math.random()*(900)));
        return localDate+randomNumber;
    }
}
